package com.um.springboot.starter.properties;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * 系统统一配置入口
 * @author 邓南辉
 * @date 2019/12/25
 * @copyright 广州优匠科技有限公司
 */
@Configuration()
@ConfigurationProperties("hsh")
public class HshProperties {


    /**
     * 系统基础配置文件
     */
    private final ConfigProperties config = new ConfigProperties();
    /**
     * 文件相关配置文件
     */
    private final FileProperties file = new FileProperties();
    /**
     * 短信相关配置文件
     */
    private final SmsProperties sms = new SmsProperties();
    /**
     * 海外版短信相关配置文件
     */
    private final SmsGlobeProperties smsGlobe = new SmsGlobeProperties();
    /**
     * 微信相关配置文件
     */
    private final WxProperties wx = new WxProperties();
    /**
     * 企业微信相关配置文件
     */
    private final QywxProperties qywx = new QywxProperties();
    /**
     * 阿里云oss文件上传配置
     */
    private final StsProperties sts = new StsProperties();
    /**
     * token校验配置
     */
    private final TokenProperties token = new TokenProperties();

    /**
     * saas平台相关的配置文件
     */
    private final SassProperties saas = new SassProperties();

    /**
     * jwt相关的配置文件
     */
    private final JwtProperties jwt = new JwtProperties();
     /**
      *  微信公众号相关配置文件
     */
    private final WxMpProperties wxMp = new WxMpProperties();

    /**
     * 微信小程序相关配置
     */
    private final WxMiniProperties wxMini = new WxMiniProperties();

    /**
     * 微信支付相关配置
     */
    private final WxPayProperties wxPay = new WxPayProperties();
    /**
     * PayPal支付相关配置
     */
    private final PayPalProperties payPal = new PayPalProperties();
    /**
     * 日志清空逻辑
     */
    private final ClearLogProperties clearLog = new ClearLogProperties();

    /**
     * Api权限是否开启
     */
    private final ApiPermissionProperties apiPermission = new ApiPermissionProperties();

    /**
     * 地图配置
     */
    private final MapProperties map = new MapProperties();


    public ConfigProperties getConfig() {
        return config;
    }

    public FileProperties getFile() {
        return file;
    }

    public SmsProperties getSms() {
        return sms;
    }

    public SmsGlobeProperties getSmsGlobe() {
        return smsGlobe;
    }

    public WxProperties getWx() {
        return wx;
    }

    public QywxProperties getQywx() {
        return qywx;
    }

    public StsProperties getSts(){
        return sts;
    }

    public TokenProperties getToken(){
        return token;
    }

    public SassProperties getSaas(){
        return saas;
    }

    public JwtProperties getJwt() {
        return jwt;
    }

    public WxMpProperties getWxMp(){
        return wxMp;
    }

    public WxMiniProperties getWxMini(){
        return wxMini;
    }

    public WxPayProperties getWxPay(){
        return wxPay;
    }

    public PayPalProperties getPayPal(){
        return payPal;
    }

    public ClearLogProperties getClearLog() {
        return clearLog;
    }

    public MapProperties getMap() {
        return map;
    }

    public ApiPermissionProperties getApiPermission() {
        return apiPermission;
    }

    public static class ConfigProperties {

        /**
         * 是否记录Api运行记录
         */
        private boolean historyLog = true;
        /**
         * 是否记录操作历史记录
         */
        private boolean recordLog = false;
        /**
         * 是否发布版本
         */
        private boolean release = false;
        /**
         * 是否打印sql
         */
        private boolean printSqlLog = true;
        /**
         * 是否启用静态资源Api
         */
        private boolean staticApi = false;
        /**
         * 是否忽略api接口不存在的参数
         */
        private boolean ignoreNotParameter = false;
        /**
         * 接口访问IP白名单
         */
        private String allowsIp = "*";
        /**
         * session 保存类型，session方式：session redis方式：redis  token方式：token sa-token方式:sa-token
         */
        private String sessionType = "session";
        /**
         * session的超时时长，单位为分钟
         */
        private int sessionTimeOut = 60;
        /**
         * 打包的方式:war或jar
         */
        private String packaging = "jar";
        /**
         * 以jar方式运行的外部配置文件路径
         */
        private String jarConfigPath;
        /**
         * 通过配置目录加载配置文件
         */
        private boolean configVolume = true;
        /**
         * 应用标识，用于区分不能的应用记录的数据
         */
        private String appFlag = "1";
        /**
         * 当值为true时，前端请求过来的custom是json对象，当为false时，custom是拼装好的查询sql
         */
        private boolean ignoreCustom = false;
        /**
         * 域名
         */
        private String domain;
        /**
         * 项目版本
         */
        private String version;
        /**
         * RSA私钥
         */
        private String privateKey;
        /**
         * RSA公钥
         */
        private String publicKey;
        /**
         * token过期时间，当为0时不过期（弃用）
         */
        
        private Long tokenExpire = 0L;
        /**
         * token校验类型，默认mysql（弃用）
         */
        
        private String tokenType = "mysql";

        /**
         * 测试金额，单位分
         */
        private Integer devAmount = 1;

        /**
         * SessionUserId数据库字段名
         */
        private String sessionUserIdField = "sys_user_id";

        /**
         * SessionUserNo数据库字段名
         */
        private String sessionUserNoField = "user_no";

        /**
         * 特定实例条件表达式，配合 @ConditionalOnSpecificInstance 注解一起使用
         */
        @Getter
        @Setter
        private String specificInstanceExpression;

        public boolean isPrintSqlLog() {
            return printSqlLog;
        }

        public void setPrintSqlLog(boolean printSqlLog) {
            this.printSqlLog = printSqlLog;
        }

        public String getVersion() {
            return version;
        }

        public void setVersion(String version) {
            this.version = version;
        }

        public boolean isHistoryLog() {
            return historyLog;
        }

        public void setHistoryLog(boolean historyLog) {
            this.historyLog = historyLog;
        }

        public boolean isRelease() {
            return release;
        }

        public void setRelease(boolean release) {
            this.release = release;
        }

        public boolean isIgnoreNotParameter() {
            return ignoreNotParameter;
        }

        public void setIgnoreNotParameter(boolean ignoreNotParameter) {
            this.ignoreNotParameter = ignoreNotParameter;
        }

        public String getAllowsIp() {
            return allowsIp;
        }

        public void setAllowsIp(String allowsIp) {
            this.allowsIp = allowsIp;
        }

        public String getPackaging() {
            return packaging;
        }

        public void setPackaging(String packaging) {
            this.packaging = packaging;
        }

        public String getJarConfigPath() {
            return jarConfigPath;
        }

        public void setJarConfigPath(String jarConfigPath) {
            this.jarConfigPath = jarConfigPath;
        }

        public String getSessionType() {
            return sessionType;
        }

        public void setSessionType(String sessionType) {
            this.sessionType = sessionType;
        }

        public int getSessionTimeOut() {
            return sessionTimeOut;
        }

        public void setSessionTimeOut(int sessionTimeOut) {
            this.sessionTimeOut = sessionTimeOut;
        }

        public boolean isRecordLog() {
            return recordLog;
        }

        public void setRecordLog(boolean recordLog) {
            this.recordLog = recordLog;
        }

        public String getAppFlag() {
            return appFlag;
        }

        public void setAppFlag(String appFlag) {
            this.appFlag = appFlag;
        }

        public boolean isIgnoreCustom() {
            return ignoreCustom;
        }

        public void setIgnoreCustom(boolean ignoreCustom) {
            this.ignoreCustom = ignoreCustom;
        }

        public String getDomain() {
            return domain;
        }

        public void setDomain(String domain) {
            this.domain = domain;
        }

        public boolean isConfigVolume() {
            return configVolume;
        }

        public void setConfigVolume(boolean configVolume) {
            configVolume = configVolume;
        }
        
        public Long getTokenExpire() {
            return tokenExpire;
        }

        public void setTokenExpire(Long tokenExpire) {
            this.tokenExpire = tokenExpire;
        }

        
        public String getTokenType() {
            return tokenType;
        }

        public void setTokenType(String tokenType) {
            this.tokenType = tokenType;
        }

        public String getPrivateKey() {
            return privateKey;
        }

        public void setPrivateKey(String privateKey) {
            this.privateKey = privateKey;
        }

        public String getPublicKey() {
            return publicKey;
        }

        public void setPublicKey(String publicKey) {
            this.publicKey = publicKey;
        }

        public Integer getDevAmount() {
            return devAmount;
        }

        public void setDevAmount(Integer devAmount) {
            this.devAmount = devAmount;
        }

        public String getSessionUserIdField() {
            return sessionUserIdField;
        }

        public void setSessionUserIdField(String sessionUserIdField) {
            this.sessionUserIdField = sessionUserIdField;
        }

        public String getSessionUserNoField() {
            return sessionUserNoField;
        }

        public void setSessionUserNoField(String sessionUserNoField) {
            this.sessionUserNoField = sessionUserNoField;
        }

        public boolean isStaticApi() {
            return staticApi;
        }

        public void setStaticApi(boolean staticApi) {
            this.staticApi = staticApi;
        }
    }

    public static class FileProperties {

        /**
         * 文件上传路径
         */
        private String path;
        /**
         * 文件临时路径
         */
        private String temp;
        /**
         * 文件下载路径
         */
        private String download;
        /**
         * 是否使用相对路径
         */
        private boolean relative = true;

        private String domain;
        /**
         * 允许上传文件类型
         */
        private String allowFileType;
        /**
         * 开关EditorUploadController上传接口访问
         */
        private boolean allowEditorUpload = true;
        /**
         * 开关UEFileController上传接口访问
         */
        private boolean allowUEditorUpload = true;
        /**
         * 开关上传接口访问
         */
        private boolean allowUpload = true;
        /**
         * 是否允许匿名上传
         */
        private boolean allowAnonymousUpload = true;

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public String getTemp() {
            return temp;
        }

        public void setTemp(String temp) {
            this.temp = temp;
        }

        public String getDownload() {
            return download;
        }

        public void setDownload(String download) {
            this.download = download;
        }

        public boolean isRelative() {
            return relative;
        }

        public void setRelative(boolean relative) {
            this.relative = relative;
        }

        public String getDomain() {
            return domain;
        }

        public void setDomain(String domain) {
            this.domain = domain;
        }

        public String getAllowFileType() {
            return allowFileType;
        }

        public void setAllowFileType(String allowFileType) {
            this.allowFileType = allowFileType;
        }

        public boolean isAllowEditorUpload() {
            return allowEditorUpload;
        }

        public void setAllowEditorUpload(boolean allowEditorUpload) {
            this.allowEditorUpload = allowEditorUpload;
        }

        public boolean isAllowUEditorUpload() {
            return allowUEditorUpload;
        }

        public void setAllowUEditorUpload(boolean allowUEditorUpload) {
            this.allowUEditorUpload = allowUEditorUpload;
        }

        public boolean isAllowUpload() {
            return allowUpload;
        }

        public void setAllowUpload(boolean allowUpload) {
            this.allowUpload = allowUpload;
        }

        public boolean isAllowAnonymousUpload() {
            return allowAnonymousUpload;
        }

        public void setAllowAnonymousUpload(boolean allowAnonymousUpload) {
            this.allowAnonymousUpload = allowAnonymousUpload;
        }
    }

    public static class SmsProperties {

        /**
         * 阿里云短信key id
         */
        private String accessKeyId;
        /**
         * 阿里云短信key secret
         */
        private String accessKeySecret;
        /**
         * 阿里云签名
         */
        private String signature;
        /**
         * 区域id
         */
        private String regionId = "cn-hangzhou";

        /**
         * 发送方号码
         */
        private String from;

        //TODO 后面可以添加其他平台的


        public String getAccessKeyId() {
            return accessKeyId;
        }

        public void setAccessKeyId(String accessKeyId) {
            this.accessKeyId = accessKeyId;
        }

        public String getAccessKeySecret() {
            return accessKeySecret;
        }

        public void setAccessKeySecret(String accessKeySecret) {
            this.accessKeySecret = accessKeySecret;
        }

        public String getSignature() {
            return signature;
        }

        public void setSignature(String signature) {
            this.signature = signature;
        }

        public String getRegionId() {
            return regionId;
        }

        public void setRegionId(String regionId) {
            this.regionId = regionId;
        }

        public String getFrom() {
            return from;
        }

        public void setFrom(String from) {
            this.from = from;
        }
    }

    public static class SmsGlobeProperties {

        /**
         * 阿里云短信key id
         */
        private String accessKeyId;
        /**
         * 阿里云短信key secret
         */
        private String accessKeySecret;
        /**
         * 阿里云签名
         */
        private String signature;
        /**
         * 区域id
         */
        private String regionId = "cn-hangzhou";

        /**
         * 发送方号码
         */
        private String from;

        //TODO 后面可以添加其他平台的


        public String getAccessKeyId() {
            return accessKeyId;
        }

        public void setAccessKeyId(String accessKeyId) {
            this.accessKeyId = accessKeyId;
        }

        public String getAccessKeySecret() {
            return accessKeySecret;
        }

        public void setAccessKeySecret(String accessKeySecret) {
            this.accessKeySecret = accessKeySecret;
        }

        public String getSignature() {
            return signature;
        }

        public void setSignature(String signature) {
            this.signature = signature;
        }

        public String getRegionId() {
            return regionId;
        }

        public void setRegionId(String regionId) {
            this.regionId = regionId;
        }

        public String getFrom() {
            return from;
        }

        public void setFrom(String from) {
            this.from = from;
        }
    }

    public static class WxProperties {

        /**
         * 微信公众号app id
         */
        private String appId;
        /**
         * 微信公众号app secret
         */
        private String appSecret;
        /**
         * 微信公众号token
         */
        private String token;
        /**
         * 微信支付商户号
         */
        private String mchId;
        /**
         * 微信支付密匙字符串
         */
        private String apiKey;
        /**
         * 微信支付回调通知url
         */
        private String notifyUrl;
        /**
         * 关注公众号，推送文章的标题
         */
        private String defaultTitle;
        /**
         * 关注公众号，推送文章的描述
         */
        private String defaultDescription;
        /**
         * 关注公众号，推送文章的封面图片
         */
        private String defaultImgUrl;
        /**
         * 关注公众号，推送文章的打开地址
         */
        private String defaultUrl;
        /**
         * 证书路径
         */
        private String p12Path;

        public String getP12Path() {
            return p12Path;
        }

        public void setP12Path(String p12Path) {
            this.p12Path = p12Path;
        }

        public String getAppId() {
            return appId;
        }

        public void setAppId(String appId) {
            this.appId = appId;
        }

        public String getAppSecret() {
            return appSecret;
        }

        public void setAppSecret(String appSecret) {
            this.appSecret = appSecret;
        }

        @Deprecated
        public String getAppSecrect() {
            return appSecret;
        }

        @Deprecated
        public void setAppSecrect(String appSecret) {
            this.appSecret = appSecret;
        }

        public String getToken() {
            return token;
        }

        public void setToken(String token) {
            this.token = token;
        }

        public String getMchId() {
            return mchId;
        }

        public void setMchId(String mchId) {
            this.mchId = mchId;
        }

        public String getApiKey() {
            return apiKey;
        }

        public void setApiKey(String apiKey) {
            this.apiKey = apiKey;
        }

        public String getNotifyUrl() {
            return notifyUrl;
        }

        public void setNotifyUrl(String notifyUrl) {
            this.notifyUrl = notifyUrl;
        }

        public String getDefaultTitle() {
            return defaultTitle;
        }

        public void setDefaultTitle(String defaultTitle) {
            this.defaultTitle = defaultTitle;
        }

        public String getDefaultDescription() {
            return defaultDescription;
        }

        public void setDefaultDescription(String defaultDescription) {
            this.defaultDescription = defaultDescription;
        }

        public String getDefaultImgUrl() {
            return defaultImgUrl;
        }

        public void setDefaultImgUrl(String defaultImgUrl) {
            this.defaultImgUrl = defaultImgUrl;
        }

        public String getDefaultUrl() {
            return defaultUrl;
        }

        public void setDefaultUrl(String defaultUrl) {
            this.defaultUrl = defaultUrl;
        }
    }

    public static class QywxProperties {

        /**
         * 企业ID
         */
        private String corpid;

        /**
         * 应用的凭证密钥
         */
        private String corpsecret;

        /**
         * 接收消息配置的token
         */
        private String token;

        /**
         * 接收消息配置的encodingAesKey
         */
        private String encodingAesKey;

        /**
         * 应用号id
         */
        private String agentid;

        public String getAgentid() {
            return agentid;
        }

        public void setAgentid(String agentid) {
            this.agentid = agentid;
        }

        public String getCorpid() {
            return corpid;
        }

        public void setCorpid(String corpid) {
            this.corpid = corpid;
        }

        public String getCorpsecret() {
            return corpsecret;
        }

        public void setCorpsecret(String corpsecret) {
            this.corpsecret = corpsecret;
        }

        public String getToken() {
            return token;
        }

        public void setToken(String token) {
            this.token = token;
        }

        public String getEncodingAesKey() {
            return encodingAesKey;
        }

        public void setEncodingAesKey(String encodingAesKey) {
            this.encodingAesKey = encodingAesKey;
        }
    }

    @Getter
    @Setter
    public static class ApiPermissionProperties {

        /**
         * 是否开启接口权限
         */
        private boolean enabled = true;

        /**
         * 拼接字符串
         */
        private String concatStr = ":";

    }

    @Getter
    @Setter
    public static class StsProperties{

        /**
         * eg: oss-cn-hangzhou.aliyuncs.com
         */
        private String endpoint;
        /**
         * eg: sts.cn-hangzhou.aliyuncs.com
         * https://www.alibabacloud.com/help/zh/doc-detail/66053.htm
         */
        private String stsEndpoint;
        /**
         * 账户accessKey
         */
        private String accessKeyId;
        /**
         * 账户accessSecret
         */
        private String accessKeySecret;
        /**
         * region 可忽略
         */
        private String region;
        /**
         * 资源名称(要扮演的角色)
         */
        private String arn;
        /**
         * bucket name
         */
        private String bucket;
        /**
         * 最大文件限制,默认1000m
         */
        private long maxSize = 1048576000;
        /**
         * 预签名过期时间，默认60s
         */
        private int presignedExpire = 60;
        /**
         * 路径前缀
         */
        private String pathPrefix;
        /**
         * 是否允许客户端自定义路径
         */
        private boolean allowClientPath = false;
        /**
         * 是否启用minio
         */
        private boolean minioEnabled = false;
    }

    
    public static class TokenProperties {

        /**
         * token字段
         */
        private String key = "token";
        /**
         * token过期时间，当为0时不过期（单位：分钟）
         */
        private Long expire = 0L;
        /**
         * token校验类型，默认mysql，支持mysql、redis
         */
        private String type = "mysql";
        /**
         * mysql数据库token表名
         */
        private String tableName = "account_token";
        /**
         * mysql数据库token表用户id字段
         */
        private String userField = "app_account_id";
        /**
         * 用户表名
         */
        private String userTableName = "app_account";
        /**
         * 是否检查用户状态
         */
        private boolean checkUserStatus = false;
        /**
         * 用户状态的字段
         */
        private String userStatusField = "status";
        /**
         * 用户有效状态
         */
        private String userStatus = "Yes";

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public Long getExpire() {
            return expire;
        }

        public void setExpire(Long expire) {
            this.expire = expire;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getUserTableName(){
            return userTableName;
        }

        public String getTableName() {
            return tableName;
        }

        public void setTableName(String tableName) {
            this.tableName = tableName;
        }

        public String getUserField() {
            return userField;
        }

        public void setUserField(String userField) {
            this.userField = userField;
        }

        public void setUserTableName(String userTableName){
            this.userTableName = userTableName;
        }

        public boolean isCheckUserStatus() {
            return checkUserStatus;
        }

        public void setCheckUserStatus(boolean checkUserStatus) {
            this.checkUserStatus = checkUserStatus;
        }

        public String getUserStatusField() {
            return userStatusField;
        }

        public void setUserStatusField(String userStatusField) {
            this.userStatusField = userStatusField;
        }

        public String getUserStatus() {
            return userStatus;
        }

        public void setUserStatus(String userStatus) {
            this.userStatus = userStatus;
        }
    }

    public static class SassProperties{

        /**
         * 是否开始saas平台
         */
        private boolean enabled = false;

        /**
         * session 类型：token 或 session
         */
        
        private String sessionType = "session";

        /**
         * comid来源：session、token、header、domain
         */
        private String channel = "session";

        /**
         * 允许全局访问的com_id
         */
        private String globalComId;

        /**
         * 获取user的sqlname
         */
        private String userSqlName = "get_user_by_token";

        /**
         * 获取comId的sqlname
         */
        private String comIdSqlName = "get_comId_by_domain";

        /**
         * com_id的字段名
         */
        private String comIdField= "com_id";

        /**
         * 开发环境环境的固定域名
         */
        private String devDomain = "";

        /**
         * 忽略自动添加公司ID（com_id）的表
         */
        private List<String> ignoreTables = new ArrayList<String>();

        /**
         * 忽略自动添加公司ID（com_id）的表(查询）
         */
        private List<String> ignoreSelectTables = new ArrayList<String>();
        /**
         * 忽略自动添加公司ID（com_id）查询的sqlNane
         */
        private List<String> ignoreSqlNames = new ArrayList<String>();

        /**
         * saas平台的域名
         */
        private String domain;

        /**
         * saas平台服务器的IP地址
         */
        private String ipAddress;

        /**
         * 区域ID:cn-hangzhou
         */
        private String regionId;
        /**
         * 云解析cdn的accessKeyId
         */
        private String accessKeyId;
        /**
         * 云解析cdn的secret
         */
        private String accessKeySecret;

        /**
         * 已废弃，请用enabled
         */
        @Deprecated
        public boolean isEnable() {
            return enabled;
        }

        /**
         * 已废弃，请用enabled
         */
        @Deprecated
        public void setEnable(boolean enable) {
            this.enabled = enable;
        }

        public boolean isEnabled() {
            return enabled;
        }

        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }

        public List<String> getIgnoreTables() {
            return ignoreTables;
        }

        public void setIgnoreTables(List<String> ignoreTables) {
            this.ignoreTables = ignoreTables;
        }

        public List<String> getIgnoreSelectTables() {
            return ignoreSelectTables;
        }

        public void setIgnoreSelectTables(List<String> ignoreSelectTables) {
            this.ignoreSelectTables = ignoreSelectTables;
        }

        public List<String> getIgnoreSqlNames() {
            return ignoreSqlNames;
        }

        public void setIgnoreSqlNames(List<String> ignoreSqlNames) {
            this.ignoreSqlNames = ignoreSqlNames;
        }

        public String getDomain() {
            return domain;
        }

        public void setDomain(String domain) {
            this.domain = domain;
        }

        public String getIpAddress() {
            return ipAddress;
        }

        public void setIpAddress(String ipAddress) {
            this.ipAddress = ipAddress;
        }

        public String getRegionId() {
            return regionId;
        }

        public void setRegionId(String regionId) {
            this.regionId = regionId;
        }

        public String getAccessKeyId() {
            return accessKeyId;
        }

        public void setAccessKeyId(String accessKeyId) {
            this.accessKeyId = accessKeyId;
        }

        public String getAccessKeySecret() {
            return accessKeySecret;
        }

        public void setAccessKeySecret(String accessKeySecret) {
            this.accessKeySecret = accessKeySecret;
        }

        public String getGlobalComId() {
            return globalComId;
        }

        public void setGlobalComId(String globalComId) {
            this.globalComId = globalComId;
        }

        
        public String getSessionType() {
            return sessionType;
        }

        
        public void setSessionType(String sessionType) {
            this.sessionType = sessionType;
        }

        public String getChannel() {
            return channel;
        }

        public void setChannel(String channel) {
            this.channel = channel;
        }

        public String getUserSqlName() {
            return userSqlName;
        }

        public void setUserSqlName(String userSqlName) {
            this.userSqlName = userSqlName;
        }

        public String getComIdField() {
            return comIdField;
        }

        public void setComIdField(String comIdField) {
            this.comIdField = comIdField;
        }

        public String getComIdSqlName() {
            return comIdSqlName;
        }

        public void setComIdSqlName(String comIdSqlName) {
            this.comIdSqlName = comIdSqlName;
        }

        public String getDevDomain() {
            return devDomain;
        }

        public void setDevDomain(String devDomain) {
            this.devDomain = devDomain;
        }
    }

    public static class JwtProperties {
        /**
         * APPID
         */
        private String appId;
        /**
         * 秘钥
         */
        private String secret;
        /**
         * 自定义拦截器地址
         */
        private String interceptorPath = "/**";
        /**
         * token过期时间
         */
        private long expireTime = 15;
        /**
         * token私钥
         */
        private String tokenSecret = "e1625cadb347c87a4349e6312d2fe64b";

        public String getAppId() {
            return appId;
        }

        public void setAppId(String appId) {
            this.appId = appId;
        }

        public long getExpireTime() {
            return expireTime;
        }

        public void setExpireTime(long expireTime) {
            this.expireTime = expireTime;
        }

        public String getTokenSecret() {
            return tokenSecret;
        }

        public void setTokenSecret(String tokenSecret) {
            this.tokenSecret = tokenSecret;
        }

        public String getSecret() {
            return secret;
        }

        public void setSecret(String secret) {
            this.secret = secret;
        }

        public String getInterceptorPath() {
            return interceptorPath;
        }

        public void setInterceptorPath(String interceptorPath) {
            this.interceptorPath = interceptorPath;
        }
    }

    public static class WxMpProperties {

        /**
         * 微信公众号app id
         */
        private String appId;
        /**
         * 微信公众号app secret
         */
        private String appSecret;
        /**
         * 微信公众号token
         */
        private String token;
        /**
         * 关注公众号，推送文章的标题
         */
        private String defaultTitle;
        /**
         * 关注公众号，推送文章的描述
         */
        private String defaultDescription;
        /**
         * 关注公众号，推送文章的封面图片
         */
        private String defaultImgUrl;
        /**
         * 关注公众号，推送文章的打开地址
         */
        private String defaultUrl;

        public String getAppId() {
            return appId;
        }

        public void setAppId(String appId) {
            this.appId = appId;
        }

        public String getAppSecret() {
            return appSecret;
        }

        public void setAppSecret(String appSecret) {
            this.appSecret = appSecret;
        }

        @Deprecated
        public String getAppSecrect() {
            return appSecret;
        }

        @Deprecated
        public void setAppSecrect(String appSecret) {
            this.appSecret = appSecret;
        }

        public String getToken() {
            return token;
        }

        public void setToken(String token) {
            this.token = token;
        }

        public String getDefaultTitle() {
            return defaultTitle;
        }

        public void setDefaultTitle(String defaultTitle) {
            this.defaultTitle = defaultTitle;
        }

        public String getDefaultDescription() {
            return defaultDescription;
        }

        public void setDefaultDescription(String defaultDescription) {
            this.defaultDescription = defaultDescription;
        }

        public String getDefaultImgUrl() {
            return defaultImgUrl;
        }

        public void setDefaultImgUrl(String defaultImgUrl) {
            this.defaultImgUrl = defaultImgUrl;
        }

        public String getDefaultUrl() {
            return defaultUrl;
        }

        public void setDefaultUrl(String defaultUrl) {
            this.defaultUrl = defaultUrl;
        }
    }

    public static class WxMiniProperties {

        /**
         * 微信小程序app id
         */
        private String appId;
        /**
         * 微信小程序app secret
         */
        private String appSecret;

        public String getAppId() {
            return appId;
        }

        public void setAppId(String appId) {
            this.appId = appId;
        }

        public String getAppSecret() {
            return appSecret;
        }

        public void setAppSecret(String appSecret) {
            this.appSecret = appSecret;
        }

        @Deprecated
        public String getAppSecrect() {
            return appSecret;
        }

        @Deprecated
        public void setAppSecrect(String appSecret) {
            this.appSecret = appSecret;
        }

    }

    public static class WxPayProperties {


        /**
         * 微信支付商户号
         */
        private String mchId;
        /**
         * 微信支付密匙字符串
         */
        private String apiKey;
        /**
         * 微信支付回调通知url
         */
        private String notifyUrl;
        /**
         * 关注公众号，推送文章的标题
         */
        /**
         * 证书路径
         */
        private String p12Path;

        public String getP12Path() {
            return p12Path;
        }

        public void setP12Path(String p12Path) {
            this.p12Path = p12Path;
        }

        public String getMchId() {
            return mchId;
        }

        public void setMchId(String mchId) {
            this.mchId = mchId;
        }

        public String getApiKey() {
            return apiKey;
        }

        public void setApiKey(String apiKey) {
            this.apiKey = apiKey;
        }

        public String getNotifyUrl() {
            return notifyUrl;
        }

        public void setNotifyUrl(String notifyUrl) {
            this.notifyUrl = notifyUrl;
        }
    }


    public static class PayPalProperties {

        /**
         * 支付商户号
         */
        private String clientId;
        /**
         * 支付密匙字符串
         */
        private String secret;

        private boolean sandbox = false;

        private String domain;

        private String returnUrl;

        private String cancelUrl;

        private String receiverEmail;

        private String currency;

        public String getClientId() {
            return clientId;
        }

        public void setClientId(String clientId) {
            this.clientId = clientId;
        }

        public String getSecret() {
            return secret;
        }

        public void setSecret(String secret) {
            this.secret = secret;
        }

        public boolean getSandbox(){
            return sandbox;
        }

        public void setSandbox(boolean sandbox){
            this.sandbox = sandbox;
        }

        public String getDomain(){
            return domain;
        }

        public void setDomain(String domain){
            this.domain = domain;
        }

        public String getReturnUrl(){
            return returnUrl;
        }
        public void setReturnUrl(String returnUrl){
            this.returnUrl = returnUrl;
        }

        public String getCancelUrl(){
            return cancelUrl;
        }
        public void setCancelUrl(String cancelUrl){
            this.cancelUrl = cancelUrl;
        }

        public String getReceiverEmail(){
            return receiverEmail;
        }
        public void setReceiverEmail(String receiverEmail){
            this.receiverEmail = receiverEmail;
        }

        public String getCurrency(){
            return currency;
        }
        public void setCurrency(String currency){
            this.currency = currency;
        }
    }

    @Setter
    @Getter
    public static class ClearLogProperties {

        /**
         * 是否启用自动清理日志
         */
        private boolean enabled = false;

        /**
         * 自动清理日志cron
         */
        private String cron;

        /**
         * 是否启用自动优化表
         */
        private boolean optimizeEnabled = false;

        /**
         * 自动优化表cron
         */
        private String optimizeCron;

        /**
         * 分批清理数量
         */
        private int limit = 5000;

        /**
         * 日志列表
         */
        private List<LogTableProperties> tables = new ArrayList<>();

        /**
         * 已废弃，请用enabled
         */
        @Deprecated
        public boolean getIsEnable() {
            return enabled;
        }

        /**
         * 已废弃，请用enabled
         */
        @Deprecated
        public void setIsEnable(String enable) {
            if(null != enable && enable.equals("true")){
                enabled = true;
            }else{
                enabled = false;
            }
        }

        @Setter
        @Getter
        public static class LogTableProperties {
            /**
             * 日志表名
             */
            private String name;

            /**
             * 时间列名
             */
            private String datetimeField;

            /**
             * 日志保留天数
             */
            private int days;

            /**
             * 已废弃，请用datetimeField
             */
            @Deprecated
            public String getDatefimeField() {
                return datetimeField;
            }

            /**
             * 已废弃，请用datetimeField
             */
            @Deprecated
            public void setDatefimeField(String datefimeField) {
                this.datetimeField = datefimeField;
            }

        }
    }

    public static class MapProperties {

        public String getAppCode() {
            return appCode;
        }

        public void setAppCode(String appCode) {
            this.appCode = appCode;
        }

        /**
         * App Code
         */
        private String appCode = "";
    }
}
